//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;

namespace CommunityServer.Components
{
	/// <summary>
	/// Summary description for CSLink.
	/// </summary>
	public class CSLink
	{

		public CSLink(string name, string resourceName, string text, string navigateUrl, string roles, string navType)
		{
			_name = name;
			_resourceName = resourceName;
			_text = text;
			_navigateUrl = navigateUrl;
			_roles = roles;
			
			if(!Globals.IsNullorEmpty(navType))
			{
				Type t = Type.GetType(navType);
				if(t != null)
					navItem = Activator.CreateInstance(t);
			}
		}

		private string _name = null;
		private string _resourceName = null;
		private string _text = null;
		private string _navigateUrl = null;
		private string _roles = null;
        private ApplicationType _appType = ApplicationType.Unknown;
		
		private object navItem = null;
        

		public string Text
		{
			get
			{
				if(_resourceName != null)
					return ResourceManager.GetString(_resourceName);
				else
					return _text;
			}
		}

        public ApplicationType ApplicationType
        {
            get{return _appType;}
            set{_appType = value;}
        }

		public string ResourceName
		{
			get
			{
				return _resourceName;
			}
		}

		public string NavigateUrl
		{
			get
			{
				return _navigateUrl;
			}
		}

		public string Name
		{
			get
			{
				return _name;
			}
		}

		public string Roles
		{
			get
			{
				return _roles;
			}
		}

		public object NavigationItem
		{
			get
			{
				return navItem;
			}
		}
	}
}
